package chapter10

import java.util.Properties

import org.apache.spark.sql.SparkSession

/**
 * author: 余辉
 * blog: https://blog.csdn.net/silentwolfyh
 * descriptions:
 * date: 2024 - 09 - 02 1:43 下午
 */
object JDBCToDF {

  def main(args: Array[String]): Unit = {

    val props = new Properties()
    props.setProperty("user","root")
    props.setProperty("password","123456")

    val spark: SparkSession = SparkSession.builder()
      .appName(this.getClass.getSimpleName)
      .master("local[*]")
      .getOrCreate()

    val df = spark.read.jdbc("jdbc:mysql://localhost:3306/ngn","student",props)
    df.show()

  }

}